package com.song.cloud.hystrixPayment8001.controller;

import cn.hutool.core.util.IdUtil;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import com.song.cloud.hystrixPayment8001.service.hystrixService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.commons.util.IdUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author ZhangGuisong
 * @Date 2021/2/19-21:52
 */
@RestController

public class hystrixController {

    @Autowired
    private hystrixService hystrixService;

    @GetMapping("/hystrix/payment/ok/{id}")
    public String getOk(@PathVariable("id") Integer id){
        String ok = hystrixService.getOk(id);
        return ok;
    }

    @GetMapping("/hystrix/payment/getError/{id}")
    public String Error(@PathVariable("id") Integer id) {
        String error = hystrixService.getError(id);
        return error;
    }
    @GetMapping("/hystrix/payment/paymentCircuitBreaker/{id}")
    public String paymentCircuitBreaker(@PathVariable("id") Integer id){
        String s = hystrixService.paymentCircuitBreaker(id);
        return s;
    }

}
